import axios from '@/utils/axios';

export const getRoles = () => {
    return axios.request({
        url: '/roles',
        method: 'get'
    });
};

export const getRole = (id) => {
    return axios.request({
        url: '/role/' + id,
        method: 'get'
    });
};

export const getRoleList = (params) => {
    return axios.request({
        url: '/roles/page',
        method: 'get',
        params
    });
};

export const addRole = (data) => {
    return axios.request({
        url: '/role',
        method: 'post',
        data
    });
};

export const editRole = (data, roleId) => {
    return axios.request({
        url: `role/${roleId}`,
        method: 'put',
        data
    });
};

export const deleteRole = (roleId) => {
    return axios.request({
        url: 'roles',
        method: 'delete',
        params: {roleIds: roleId}
    });
};
